﻿#region License
//------------------------------------------------------------
// Copyright (c) Denis Vuyka.  All rights reserved.
// This source code is subject to terms and conditions of the 
// Microsoft Reciprocal License (Ms-RL) License for Carcass. 
// A copy of the license can be found in the License.txt file 
// at the root of this distribution. 
// By using this source code in any fashion, you are agreeing 
// to be bound by the terms of the 
// Microsoft Reciprocal License (Ms-RL) License
// You must not remove this notice from this software.
//------------------------------------------------------------
#endregion

using System.Windows;
using AvalonDock;

namespace DemoShell
{
  public static class DockManagerExtensions
  {
    public static void LoadNewDockableContent(this DockingManager DocManager, UIElement content, string title, AnchorStyle anchorTo, bool autoHide)
    {
      DockablePane PaneToAnchor = new DockablePane();

      PaneToAnchor.SetValue(ResizingPanel.ResizeWidthProperty, 200.0);
      PaneToAnchor.SetValue(ResizingPanel.ResizeHeightProperty, 200.0);

      DockableContent dc = new DockableContent
      {
        Content = content,
        DockableStyle = DockableStyle.Dockable,
        Title = title,
        IsEnabled = true
      };

      PaneToAnchor.Items.Add(dc);

      DocManager.Anchor(PaneToAnchor, anchorTo);
    }    
  }
}
